﻿<%@ Page Language="c#" Inherits="Rmlife.Web.managesubmenu" CodeBehind="managesubmenu.aspx.cs"
    AutoEventWireup="false" MasterPageFile="~/mContentContainer.Master" Title="菜单管理" %>

<%@ Register TagPrefix="cc1" Namespace="Rmlife.Control" Assembly="Rmlife.Control" %>
<%@ Register Src="../UserControls/PageInfo.ascx" TagName="PageInfo" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript">
	        function newMenu()
            {
                document.getElementById("opt").innerHTML = "新建子菜单";
                document.getElementById("submenuid").value = "0";
                document.getElementById("menutitle").value = "";
                BOX_show('neworeditsubmenu');
            }
            function editMenu(menuid,menutitle)
            {
                document.getElementById("opt").innerHTML = "编辑子菜单";
                document.getElementById("submenuid").value = menuid;
                document.getElementById("menutitle").value = menutitle;
                BOX_show('neworeditsubmenu');
            }
            function chkSubmit()
            {
                if(document.getElementById("menutitle").value == "")
                {
                    alert("子菜单名称不能为空！");
                    document.getElementById("menutitle").focus();
                    return false;
                }
                document.getElementById("aspnetForm").submit();
                return true;
            }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlace" runat="server">
    <uc1:PageInfo ID="info1" runat="server" Icon="information" Text="子菜单中必须在其下没有子菜单项时才可删除!" />
    <asp:Panel runat="server" ID="panel">
        <cc1:DataGrid ID="DataGrid1" runat="server">
            <Columns>
                <asp:BoundColumn DataField="menutitle" HeaderText="子菜单名称"></asp:BoundColumn>
                <asp:TemplateColumn HeaderText="操作">
                    <HeaderStyle Width="30%" />
                    <ItemTemplate>
                        <a href="javascript:;" onclick="editMenu('<%# DataBinder.Eval(Container, "DataItem.id").ToString() %>','<%# DataBinder.Eval(Container, "DataItem.menutitle").ToString() %>');">
                            编辑</a>&nbsp;
                        <%# DataBinder.Eval(Container, "DataItem.delitem").ToString()%>&nbsp; <a href="managesubmenuitem.aspx?menuid=<%# DataBinder.Eval(Container, "DataItem.menuid").ToString() %>&submenuid=<%# DataBinder.Eval(Container, "DataItem.submenuid").ToString() %>&pagename=<%# Server.UrlEncode(DataBinder.Eval(Container, "DataItem.menutitle").ToString()) %>">
                            管理子菜单项</a>
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </cc1:DataGrid>
        <p style="text-align: right;">
            <button type="button" class="ManagerButton" id="Button2" onclick="newMenu();">
                <img src="../images/add.gif" />
                新 建
            </button>
            &nbsp;
            <button type="button" class="ManagerButton" id="Button3" onclick="window.location='managemainmenu.aspx';">
                <img src="../images/arrow_undo.gif" />
                返 回
            </button>
        </p>
        <div id="BOX_overlay" style="background: #000; position: absolute; z-index: 100;
            filter: alpha(opacity=50); -moz-opacity: 0.6; opacity: 0.6;">
        </div>
        <div id="neworeditsubmenu" style="display: none; background: #fff; padding: 10px;
            border: 1px solid #999; width: 400px;">
            <div class="ManagerForm">
                <fieldset>
                    <legend id="opt" style="background: url(../images/icons/icon53.jpg) no-repeat 6px 50%;">
                        新建主菜单</legend>
                    <table cellspacing="0" cellpadding="4" class="tabledatagrid" width="80%">
                        <tr>
                            <td style="width: 90px; height: 35px;">
                                子菜单名称:<input type="hidden" id="submenuid" name="submenuid" value="0" />
                            </td>
                            <td>
                                <input id="menutitle" name="menutitle" type="text" maxlength="8" size="10" class="FormBase"
                                    onfocus="this.className='FormFocus';" onblur="this.className='FormBase';" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center" style="height: 35px;">
                                <button type="button" class="ManagerButton" id="AddNewRec" onclick="chkSubmit();">
                                    <img src="../images/add.gif" />
                                    提 交
                                </button>
                                &nbsp;&nbsp;
                                <button type="button" class="ManagerButton" id="Button1" onclick="BOX_remove('neworeditsubmenu');">
                                    <img src="../images/state1.gif" />
                                    取 消
                                </button>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </div>
        </div>
        <div id="setting" />
    </asp:Panel>
    <asp:Label ID="msg" runat="server" CssClass="msg"></asp:Label>
</asp:Content>
